
<div id="appDialogCraftPrice" v-cloak>
    <el-dialog  :visible.sync="dialogCraftPriceVisible"  fullscreen>
        <el-row :gutter="50">
            <!--左侧table显示-->
            <el-col :span="6" >
                <div style="padding-bottom: 13px">
                    <h5>{{title}}</h5>
                </div>
                <div >
                    <el-table
                            ref="goodsCraftAttributeTable"
                            :data="goodsCraftAttributeData"
                            border="true"
                            size="small"
                            highlight-current-row="true"
                            style="width: 100%"
                            max-height="650"
                            @row-click="goodsCraftAttributeClicked"
                         >
                        <el-table-column
                                prop="attributeName"
                                label="工艺名称"
                                >
                        </el-table-column>
                        <el-table-column
                                prop="craftFormula"
                                label="算价公式"
                        >
                        </el-table-column>
                    </el-table>
                </div>
            </el-col>
            <!--右侧table显示-->
            <el-col :span="18">
                <div style="padding-bottom: 15px">
                    <el-button-group >
                        <el-button type="primary" size="small"  icon="el-icon-news" @click="saveGoodsCraftPrice">批量保存</el-button>
                        <el-button type="warning" size="small" icon="el-icon-setting" @click="oneKeySetPrice">一键设价</el-button>
                        <el-button type="danger" size="small" icon="el-icon-delete" @click="deleteCraftPrice">删除</el-button>
                    </el-button-group>
                </div>
                <div>
                    <el-table
                            ref="goodsCraftOptionTable"
                            :data="goodsCraftOptionData"
                            @select="goodsCraftOptionSelected"
                            @select-all="goodsCraftOptionSelectedAll"
                            stripe="true"
                            border="true"
                            size="small"
                            highlight-current-row="true"
                            style="width: 100%"
                            max-height="650"
                            >
                        <el-table-column  type="selection"  width="55"> </el-table-column>

                        <el-table-column  prop="optionName" label="选项名称"></el-table-column>

                        <el-table-column  prop="influenceName" label="影响工艺价选项"></el-table-column>

                        <el-table-column label="单价(元)" width="120">
                            <template slot-scope="scope">
                                <el-input size="small" v-model="scope.row.unitPrice" ></el-input>
                            </template>
                        </el-table-column>

                        <el-table-column  label="每张最低消费(元)"  width="120">
                            <template slot-scope="scope">
                                <el-input size="small" v-model="scope.row.minUnitPrice" ></el-input>
                            </template>
                        </el-table-column>

                        <el-table-column prop="province" label="起步价(开机费)元" width="120">
                            <template slot-scope="scope">
                                <el-input size="small" v-model="scope.row.minBeginPrice" ></el-input>
                            </template>
                        </el-table-column>

                        <el-table-column prop="province" label="模板费元" width="120">
                            <template slot-scope="scope">
                                <el-input size="small" v-model="scope.row.fixedPrice" ></el-input>
                            </template>
                        </el-table-column>

                        <el-table-column   label="利润系数" width="100">
                            <template slot-scope="scope">
                                <el-input size="small" v-model="scope.row.floatCoefficient" ></el-input>
                            </template>
                        </el-table-column>

                        <el-table-column   label="阶梯价格" width="100">
                            <template slot-scope="scope">
                                <el-popover trigger="hover" placement="top" >
                                    <p>{{ scope.row.stepPrice }}</p>
                                    <div slot="reference" class="name-wrapper">
                                        <el-button size="small" slot="append" icon="el-icon-setting" @click="openStepPriceDialog(scope.row)">阶梯价</el-button>
                                    </div>
                                </el-popover>

                            </template>
                        </el-table-column>

                    </el-table>
                </div>
            </el-col>
        </el-row>


    </el-dialog>
    <!--阶梯价格弹窗-->
    <el-dialog
            title="阶梯价格设置"
            :visible.sync="stepPriceDialogVisible"
            width="600px"
    >
        <div>
            <el-table
                    ref="stepPriceTable"
                    :data="stepPriceData"
                    stripe="true"
                    border="true"
                    size="small"
                    highlight-current-row="true"
                    style="width: 100%"
                    max-height="400">

                <el-table-column  label="开始数量" width="100">
                    <template slot-scope="scope">
                        <el-input size="small" v-model="scope.row.beginNum" ></el-input>
                    </template>
                </el-table-column>

                <el-table-column  label="结束数量" width="100">
                    <template slot-scope="scope">
                        <el-input size="small" v-model="scope.row.endNum" ></el-input>
                    </template>
                </el-table-column>

                <el-table-column  label="单价" width="100">
                    <template slot-scope="scope">
                        <el-input size="small" v-model="scope.row.singlePrice" ></el-input>
                    </template>
                </el-table-column>

                <el-table-column  label="备注" width="150">
                    <template slot-scope="scope">
                        <el-input size="small" v-model="scope.row.remark" ></el-input>
                    </template>
                </el-table-column>

                <el-table-column
                        label="操作"
                        width="100">
                    <template slot-scope="scope">
                        <el-button
                                @click.native.prevent="addOneStepPrice"
                                type="text"
                                size="small">
                            添加
                        </el-button>
                        <el-button
                                @click.native.prevent="deleteOneStepPrice(scope.$index, stepPriceData)"
                                type="text"
                                size="small">
                            删除
                        </el-button>
                    </template>
                </el-table-column>
            </el-table>

        </div>
        <span slot="footer" class="dialog-footer">
                <el-button size="small" @click="stepPriceDialogVisible = false">取 消</el-button>
                <el-button size="small" type="primary" @click="saveStepPrice">保存</el-button>
            </span>
    </el-dialog>
    </div>
</div>

<script src="${request.contextPath}/statics/js/modules/goodsCraftPrice/goodsCraftPricePage.js?_${.now?long}"></script>
